switch(curstate)
       {
            case START:
                matching=false;
                parsearray.clear();
                switch(varVector.at(0).type)
                {
                case BYTE:
                    if(varVector.at(0).fixed) // Fixed amount of bytes
                    {
                        if(varVector.at(0).matchArray.size()<varVector.at(0).length && i<inarray.size())
                        {
                            varVector[0].matchArray.append(inarray.at(i));
                        }
                        if(varVector.at(0).matchArray.size()==varVector.at(0).length)  // First byte array was completely received
                        {
                            curstate=PARSE;
                            vecIndex=1;
                            testvarstruct->append(varVector[0].matchArray);
                            if(varVector.size()==1)
                            {
                                curstate=START;
                                vecIndex=0;
                                emit(vectorout(varVector));
                                varVector[0].matchArray.clear();
                            }
                        }
                    }
                    else  // Variable amount of bytes
                    {
                        // Accept bytes until a number is found or until the first matching character in the next variable is found
                        if(inarray.at(i)>=48 && inarray.at(i)<=57)
                        {
                            curstate=PARSE;
                            vecIndex=1;
                            testvarstruct->append(varVector[0].matchArray);
                            // Check if there are any more variables left in the vector
                            // Assume next variable is a number
                            if(varVector[vecIndex].type==NUMBER)
                            {
                                varVector[vecIndex].matchArray.clear();
                                varVector[vecIndex].matchArray.append(inarray[i]);
                                varVector[vecIndex].floatvalue=inarray.at(i)-48;
                            }
                            else // Reset vector
                            {
                                curstate=START;
                                vecIndex=0;
                                emit(vectorout(varVector));
                                varVector[0].floatvalue=0;
                                varVector[0].matchArray.clear();
                            }
                        }
                        else if(inarray.at(i)==varVector.at(1).matchArray.at(0)) // found first character of array to match
                        {
                            varVector[0].matchArray.append(inarray.at(i));
                        }
                        else
                        {

                        }
                    }
                    break;
        case NUMBER:
                    if(varVector.at(0).fixed) // Fixed amount of numbers
                    {
                        varVector[0].matchArray.append(inarray.at(i));
                        if(inarray.at(i)>=48 && inarray.at(i)<=57)
                        {
                            // Check character for number or decimal point
                            if(pastdecimal)
                            {  // Right side of decimal point
                                int tempnum=1;
                                double tempdec;
                                for(unsigned int k=0;k<decimalPlace;k++)
                                {
                                    tempnum*=10;
                                }
                                tempdec=(double)(inarray.at(i)-48)/tempnum;
                                varVector[0].floatvalue+=tempdec;
                                decimalPlace++;

                            }
                            else  // Left side of decimal point
                            {
                                varVector[0].floatvalue*=10;
                                varVector[0].floatvalue+=inarray.at(i)-48;
                            }
                        }
                        else // Received non-number byte
                        {
                            switch(inarray.at(i))
                            {
                            case '.':
                                if(!pastdecimal)
                                {
                                    pastdecimal=true;
                                    decimalVal=0;
                                    decimalPlace=1;
                                }
                                else
                                {
                                    //    if(i>0) i--;
                                    curstate=START;
                                    testvarstruct->append(QString("%1").arg(varVector[0].floatvalue));
                                    pastdecimal=false;
                                    decimalPlace=1;
                                    varVector[0].floatvalue=0;
                                    varVector[0].matchArray.clear();
                                }
                                break;
                            case ' ':
                                if(varVector[0].floatvalue>0)
                                {
                                    //     if(i>0) i--;
                                    curstate=START;
                                    testvarstruct->append(QString("%1").arg(varVector[0].floatvalue));
                                    pastdecimal=false;
                                    decimalPlace=1;
                                    varVector[0].floatvalue=0;
                                    varVector[0].matchArray.clear();
                                }
                                break;
                           default:
                                curstate=START;
                                testvarstruct->append(QString("%1").arg(varVector[0].floatvalue));
                                pastdecimal=false;
                                decimalPlace=1;
                                varVector[0].floatvalue=0;
                                varVector[0].matchArray.clear();
                                break;
                            }
                        }
                        if(varVector.at(0).matchArray.size()==varVector.at(0).length)  // First byte array was completely received
                        {
                            curstate=PARSE;
                            vecIndex=1;
                            testvarstruct->append(QString("OK: %1").arg(varVector[0].floatvalue));
                            pastdecimal=false;
                            decimalPlace=1;
                            if(varVector.size()==1)
                            {
                                curstate=START;
                                vecIndex=0;
                                emit(vectorout(varVector));
                                varVector[0].floatvalue=0;
                                varVector[0].matchArray.clear();
                            }

                        }
                    }
                    else  // Variable amount of numbers
                    {
                        //  Accept number characters until something else starts
                        if(inarray.at(i)>=48 && inarray.at(i)<=57) // Received number character
                        {
                            varVector[0].matchArray.append(inarray.at(i));
                        }
                        else
                        {
                            switch(inarray.at(i))
                            {
                            case '.':
                                if(!pastdecimal)
                                {
                                    pastdecimal=true;
                                    decimalVal=0;
                                    decimalPlace=1;
                                    varVector[0].matchArray.append('.');
                                }
                                else
                                {
                                    if(i>0) i--;
                                    curstate=PARSE;
                                    vecIndex=1;
                                    varVector[0].floatvalue=varVector[0].matchArray.toDouble();
                                    testvarstruct->append(QString("%1").arg(varVector[0].floatvalue));
                                    pastdecimal=false;
                                    decimalPlace=1;
                                    varVector[0].floatvalue=0;
                                    varVector[0].matchArray.clear();
                                    if(varVector.size()==1)
                                    {
                                        curstate=START;
                                        vecIndex=0;
                                        emit(vectorout(varVector));
                                        varVector[0].floatvalue=0;
                                        varVector[0].matchArray.clear();
                                    }
                                }
                                break;
                            case ' ':
                                if(varVector[0].floatvalue>0)
                                {
                                    if(i>0) i--;
                                    curstate=PARSE;
                                    vecIndex=1;
                                    varVector[0].floatvalue=varVector[0].matchArray.toDouble();
                                    testvarstruct->append(QString("%1").arg(varVector[0].floatvalue));
                                    pastdecimal=false;
                                    decimalPlace=1;
                                    varVector[0].floatvalue=0;
                                    varVector[0].matchArray.clear();
                                    if(varVector.size()==1)
                                    {
                                        curstate=START;
                                        vecIndex=0;
                                        emit(vectorout(varVector));
                                        varVector[0].floatvalue=0;
                                        varVector[0].matchArray.clear();
                                    }
                                }
                                break;
                                default:// End of number reached
                                    if(i>0) i--;
                                    curstate=PARSE;
                                    vecIndex=1;
                                    varVector[0].floatvalue=varVector[0].matchArray.toDouble();
                                    testvarstruct->append(QString("%1").arg(varVector[0].floatvalue));
                                    pastdecimal=false;
                                    decimalPlace=1;
                                    varVector[0].floatvalue=0;
                                    varVector[0].matchArray.clear();
                                    if(varVector.size()==1)
                                    {
                                        curstate=START;
                                        vecIndex=0;
                                        emit(vectorout(varVector));
                                        varVector[0].floatvalue=0;
                                        varVector[0].matchArray.clear();
                                    }
                                    break;
                                }
                        }
                    }
                    break;
        default: // Unhandled
            break;
        }
                break;
    case PARSE: // Checking inarray bytes against variable properties
        break;
    case VALIDATE: // Checking further inarray bytes to validate current variable, only necessary when there is a variable length parsed
        break;
    default: // Unhandled
        break;
}
